package stud.aistar.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import stud.aistar.entity.Image;
import stud.aistar.mapper.MedicalVoMapper;
import stud.aistar.service.IMedicalVoService;
import stud.aistar.util.DateUtil;
import stud.aistar.vo.MedicalVo;

import java.util.List;

/**
 * Created by 甲乙饼叮叮 on 2019/10/12.
 */
@Service
@Transactional
public class MedicalVoServiceImpl implements IMedicalVoService{

    @Autowired
    private MedicalVoMapper mapper;

    @Override
    public PageInfo<MedicalVo> findByUsersId(Integer id, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<MedicalVo> medicalVos = mapper.findByUsersId(id);
        PageInfo<MedicalVo> pageInfo = new PageInfo<>(medicalVos);
        return pageInfo;
    }

    @Override
    public List<MedicalVo> findByUsersId(Integer id) {
        List<MedicalVo> medicalVos = mapper.findByUsersId(id);
        return medicalVos;
    }

    @Override
    public void saveMed(Image image) {
        mapper.saveMed(image);
    }

    @Override
    public MedicalVo findByMid(Integer id) {
        return mapper.findByMid(id);
    }

    @Override
    public void updateMed(Image image) {
        mapper.updateMed(image);
    }

}
